package com.vince.hulk.character
{
import org.flixel.FlxObject;

/**
 * author yangwz
 */		
public class LargeCharacter extends Character
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	/**
	 * Constructs a new <code>LargeCharacter</code> instance.
	 * 
	 */
	public function LargeCharacter(X:Number=0, Y:Number=0)
	{
		super(X, Y, null);
		loadGraphic(blobLargeImg, true, true, 120, 120);
		addAnimation("walk", [4, 1, 2, 3], 4, true);
		addAnimation("idle", [0, 5], 2, true);
		addAnimation("jump", [3, 1], 2, false);
		_moveSpeed = 200;
		_jumpPower = 300;
		width = 70;
		offset.x = 15;
	}
	//==========================================================================
	//  Variables
	//==========================================================================
	[Embed(source = "assets/HulkLarge.png")]
	private var blobLargeImg:Class;
	//==========================================================================
	//  Methods
	//==========================================================================
	/**
	 * 分开 
	 * @return 
	 */	
	override public function split():Array
	{
		var arr:Array = new Array();
		var smallCharacter:SmallCharacter = new SmallCharacter(x, y);
		smallCharacter.y = y + height - smallCharacter.height;
		var mediumCharacter:MediumCharacter = new MediumCharacter(x + width / 2, y);
		mediumCharacter.y = y + height - mediumCharacter.height;
		arr.push(smallCharacter, mediumCharacter);
		kill();
		return arr;
	}
	
	override public function size():int
	{
		return 3;
	}
	
	override public function update() : void
	{
		if (facing == RIGHT)
		{
			offset.x = 30;
		}
		else
		{
			offset.x = 10;
		}
		if (velocity.x != 0 && isTouching(FlxObject.DOWN))
		{
			play("walk");
		}
		else if (!isTouching(FlxObject.DOWN))
		{
			play("jump");
		}
		else
		{
			play("idle");
		}
		super.update();
	}
}
}